// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/parking/api/ParkPointApi'

import TreeClass from '@api/parking/model/ParkPointTreeReq'
import SubmitClass from '@api/parking/model/ParkPointReq'

const CLIENT = CORE.grpcCLIENT(Client)

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 结构树 —————————————————————————————— //

  async getTree(treeParam, TIP = '查询车库') {
    const DTO = CORE.grpcDTO(TreeClass, treeParam)
    const resp = await CORE.grpc(TIP, CLIENT, 'queryParkPointTree', DTO)
    return resp.parkPoint || []
  },

  // —————————————————————————————— 同步 —————————————————————————————— //

  async submit(treeParam, TIP = '车库同步') {
    const DTO = CORE.grpcDTO(SubmitClass, treeParam)
    await CORE.grpc(TIP, CLIENT, 'synchronizeThirdPark', DTO)
    return CORE.grpcOK(TIP)
  },
}
